<%@page import="com.is.control.ParamClassControl"%>
<%@page import="com.is.model.ParamClass"%>
<%@page import="com.is.control.ParamCourseControl"%>
<%@page import="com.is.model.ParamCourse"%>
<%@page import="com.is.control.CourseClassControl"%>
<%@page import="com.is.model.CourseClass"%>
<%@page import="com.is.control.ParamStuyearControl"%>
<%@page import="com.is.model.ParamStuyear"%>
<%@page import="com.is.model.User"%>
<%@page import="com.is.control.UserControl"%>
<%@page import="java.util.List"%>
<%@page import="com.is.util.DateTime"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.is.servlet.TokenProcessor"%>
<%@page import="com.is.control.TeacherAssessControl"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="/InterStu/resources/image/favicon.ico" />
<script type="text/javascript" src="../../resources/js/WebCalendar.js"></script>
<link rel="stylesheet" type="text/css" href="../../resources/css/all.css" />
<link href="../../resources/css/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../resources/js/jquery-1.8.1.js"></script>
<script type="text/javascript" src="../../resources/js/jquery.artDialog.js"></script>
<script type="text/javascript" src="../../resources/js/iframeTools.js"></script>
<script type="text/javascript">
function doSubmit(){
      var submit = document.getElementById("submit");
      submit.disabled="disabled";
      return true;
}

$(function(){
		var block = $("#magic_block");
		if($(".active a").position()){
			block.css("top",$(".active a").position().top+10)
			.data("oriTop",$(".active a").position().top)
		}
		$(".nav ul li").find("a").hover(
			function(){
				var $this = $(this);
				var newTop = $this.position().top;
				block.stop().animate({
					top:newTop+10
				})
			},
			function(){
				block.stop().animate({
					top:block.data("oriTop")+10
				})
			}
		)
		$("input[type='text']")
		.mouseover(function(){
			this.focus();
		})
		.focus(function(){
			this.select();
		})
		.mouseout(function(){
			this.blur();
		})
		.css("width","80")
		$(".update").click(function(){
			$.dialog.open("/InterStu/update_info.jsp",{width:460,height:400,title:"个人信息"});
		})
		$('img').error(function(){
			this.src = "/InterStu/resources/image/man.GIF";
		})
		var h = $(".right").height();
		$(".left").height(h);
		/*numonly*/
		var numreg = /^\d+\.?\d*$/;
		$("input[type='text']").bind("input",function(){
			if(!numreg.test($(this).val())){
				var tem = $(this).val().substring(0,$(this).val().length-1)
				$(this).val(tem);
			}
		})
		$("[name='reset']").click(function(){
			$("input[type='text']").val("0.0");
		})
})
</script>
<title>留学生预科班</title>
</head>
<body>
<%
      User cu = (User)session.getAttribute("user");
%>
<div class="header">
	<div class="title pr">
    	<a href="javascript:void(0);"><span class="update pa">个人信息</span></a>
        <span class="logout pa"><a class="hide" href="/InterStu/login/logout.jsp">退出</a></span>
    </div>
</div>
<div class="main">
	<div class="left">
	  <div class="infomation">
			<div class="photo">
			<%
			String picUrl = cu.getPicUrl();
			if(session.getAttribute("picUrl")!=null){
			    picUrl = "/InterStu/User/UserHeadImage/"+(String)session.getAttribute("picUrl");
			}	
			System.out.print(picUrl);
			%>
				<img width='60' height="60" src = "<%=picUrl %>"   />
			</div>
			<div class="welcome">
				<%=cu.getName() %>,<br/>
				欢迎您使用！
			</div>
		</div>  	   	
    	<div class="nav">
        	<ul>	
            	<%if(cu!=null&&cu.getRole().equals("1")){ %>
            	<li class="pa" id="magic_block"></li>
                <li><a href="/InterStu/pages/stuyear/stuyear_start.jsp">新学期设置</a></li>
                <li><a href="/InterStu/pages/users/user_all.jsp">用户管理</a></li>
                <%} %>
                <li><a href="/InterStu/pages/students/student_add.jsp">学生管理</a></li>
                <li ><a href="/InterStu/pages/dictation/dictation_add.jsp">学生考核</a></li>
                <%if(cu!=null&&cu.getRole().equals("1")){ %>
                <li class="active"><a href="/InterStu/pages/assess/teacher_assess.jsp">教职人员管理</a></li>
                <%} %>
            </ul>
        </div>
    </div>
    <div class="right">
    	<div class="r1">
    	<table class="teacher tab">
	    <tr>
	    	<td>
	    		<a href="/InterStu/pages/assess/teacher_assess.jsp">查看考核</a>
			</td>
			<td>
				<a class="current" href="/InterStu/pages/assess/teacher_assess_add.jsp">添加考核</a>
			</td>
	    </tr>
	    </table>
		
<%
       int  stuyear = ParamStuyearControl.getStuyearIdByTime(DateTime.SimpleDate());
 %>
<form action="teacher_assess_add_do.jsp" method="post" onsubmit="return doSubmit()">
<table class="table">
<caption>
今天是<%=DateTime.SimpleDate() %>，现在进行的操作是录入教职工考核情况<%if(TeacherAssessControl.getLastInsertTime()!=null&&!TeacherAssessControl.getLastInsertTime().equals("")) out.print("，您上一次进行该操作的时间是"+TeacherAssessControl.getLastInsertTime()); %>：
</caption>
<thead>
<tr>
	<th>教师</th>
	<th>课程</th>
	<th>班级</th>
	<th>工作课时</th>
	<th>缺勤(/课时)</th>
	<th>额外(/课时)</th>
	<th>请假(/课时)</th>
</tr>
</thead>
<tbody>
<tr><td  colspan="7" style="height:28px;" align="center">任课教师部分</td></tr>
<%
           List<CourseClass> ccs = CourseClassControl.getAllCourseClassIdByUidAndStuyear(0, stuyear);
          // List<User> users = UserControl.getAllUsersByRole("");
          int mark=0;
           for(CourseClass cc:ccs){	
                
                User u = UserControl.getUserById(cc.getUid());
                ParamCourse pco = ParamCourseControl.getCourseById(cc.getCourseId());
           %>
           <tr>
           		<td><%=u.getName() %></td>
           		<td><%=pco.getCourseName() %>(<%=pco.getCourseNameEn() %>)</td>
               <td><%= ParamClassControl.getClassName(cc.getClassId()) %></td>
               <td><input type="text" name="classAmount<%=mark %>" value="0.0" /></td>
               <td><input type="text" name="absentAmount<%=mark %>"  value="0.0" /></td>
               <td><input type="text" name="extraAmount<%=mark %>"  value="0.0"  /></td>
               <td>
               		<input type="text" name="leaveAmount<%=mark %>"  value="0.0" />
               		<input type="hidden" name="uid<%=mark %>" value="<%=u.getId()%>"/>
               		<input type="hidden" name="courseId<%=mark%>" value="<%=cc.getCourseId()%>"/>
               </td>
             </tr>
           <%
           mark++;
           }
 %>
 <tr><td style="height:28px;" colspan="7">非任课教师部分</td></tr>
 <%
             List<User> u2s = UserControl.getAllUsersByRole("2"); //2表示为非任课教师，需要注意的是，如果一个任课教师没有分配课程，是在该页面无法列出来的
             for(User u2:u2s){
            	 %>
                <tr><td><%=u2.getName() %></td>
                <td>无</td>
               <td>无</td>
               <td><input type="text" name="classAmount<%=mark %>" value="0.0" /></td>
               <td><input type="text" name="absentAmount<%=mark %>"  value="0.0" /></td>
               <td><input type="text" name="extraAmount<%=mark %>"  value="0.0"  /></td>
               <td>
	               <input type="text" name="leaveAmount<%=mark %>"  value="0.0" />
	               <input type="hidden" name="uid<%=mark %>" value="<%=u2.getId()%>"/>
	               <input type="hidden" name="courseId<%=mark%>" value="0"/>
               </td>
             </tr>
            	 <%
            	 mark++;
             }
 %>
 <tr>
 <td colspan="7">
	<input type="hidden" name="size" value="<%=mark%>"/>
	<!-- 获取此表单随机生成唯一序列 -->
	<input type="hidden" name="token" value="<%=TokenProcessor.generateToken(request,response)%>"/>
	<input type="button" name="reset" value="重置" /> 
	&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="添加" id="submit"/></td>
</tr>
</tbody>
</table>
 </form>
     </div>
</div>
</div>
<div class="footer">
	<p>版权所有：东北师范大学留学生预科部&nbsp;&nbsp;  蓝旭工作室开发</p>
</div>
</body>
</html>